package com.rickpan.event;

import com.rickpan.entity.TransferRecord;
import org.springframework.context.ApplicationEvent;

/**
 * 传输事件基类
 */
public abstract class TransferEvent extends ApplicationEvent {
    
    private final TransferRecord transferRecord;
    
    public TransferEvent(Object source, TransferRecord transferRecord) {
        super(source);
        this.transferRecord = transferRecord;
    }
    
    public TransferRecord getTransferRecord() {
        return transferRecord;
    }
    
    /**
     * 传输进度更新事件
     */
    public static class TransferProgressEvent extends TransferEvent {
        public TransferProgressEvent(Object source, TransferRecord transferRecord) {
            super(source, transferRecord);
        }
    }
    
    /**
     * 传输完成事件
     */
    public static class TransferCompletedEvent extends TransferEvent {
        public TransferCompletedEvent(Object source, TransferRecord transferRecord) {
            super(source, transferRecord);
        }
    }
    
    /**
     * 传输失败事件
     */
    public static class TransferFailedEvent extends TransferEvent {
        public TransferFailedEvent(Object source, TransferRecord transferRecord) {
            super(source, transferRecord);
        }
    }
}
